import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
matplotlib inline
poll_results = pd.read_csv('linux_poll_data.csv')
poll_results.head()
recommendation | votes | class | |
---|---|---|---|
0 | Lubuntu | 2 | distro |
1 | Linux Mint | 17 | distro |
2 | Zorin OS | 0 | distro |
3 | NixOS | 5 | distro |
4 | EndeavourOS | 2 | distro |
distros = poll_results[(poll_results['class'] == 'distro') & (poll_results['votes'] > 0)]
distros = distros.sort_values(by=['votes', 'recommendation'], ascending=[False, True])
distros
recommendation | votes | class | |
---|---|---|---|
1 | Linux Mint | 17 | distro |
6 | Fedora | 5 | distro |
3 | NixOS | 5 | distro |
5 | Arch | 4 | distro |
8 | Debian | 4 | distro |
7 | Manjaro | 3 | distro |
4 | EndeavourOS | 2 | distro |
0 | Lubuntu | 2 | distro |
9 | Ubuntu | 2 | distro |
13 | Crystal Linux | 1 | distro |
10 | Devuan | 1 | distro |
12 | Void Linux | 1 | distro |
11 | openSUSE | 1 | distro |
desktops = poll_results[poll_results['class'] == 'desktop']
desktops = desktops.sort_values(by=['votes'], ascending=False)
desktops
recommendation | votes | class | |
---|---|---|---|
17 | KDE Plasma | 2 | desktop |
14 | GNOME | 1 | desktop |
15 | i3 | 1 | desktop |
16 | XFCE | 1 | desktop |
# distros bar chart
plt.title('Linux Distro Recommendations from Mastodon')
plt.ylabel('Votes')
plt.bar(distros.recommendation, distros.votes)
plt.tick_params(axis='x', direction='out', labelrotation=45)
plt.grid(axis='y', which='major', linestyle=':', zorder=1)
plt.savefig('distros.png', dpi=600, bbox_inches='tight')
plt.show()
# desktops bar chart
plt.title('Linux Desktop Recommendations from Mastodon')
plt.ylabel('Votes')
plt.bar(desktops.recommendation, desktops.votes)
plt.savefig('desktops.png', dpi=600, bbox_inches='tight')
plt.show()